﻿using System.Linq.Expressions;
using BDQN.Entites;
                           
namespace BDQN.IDAL
{
    public interface IBaseDal<T> where T : BaseEntity,new()
    {
        Task<int> AddAsync(T entity,bool isSaved = true);

        Task<int> EditAsync(T entity, bool isSaved = true);

        Task<int> RemoveAsync(T entity, bool isSaved = true);

        Task<List<T>> QueryAsync();

        Task<List<T>> QueryAsync(Expression<Func<T, bool>> whereLambda);

        Task<T> QueryAsync(int id);

        List<T> Query();

        List<T> Query(Expression<Func<T,bool>> whereLambda);

        T Query(int id);
        //我们需要重写一下 保存数据的方法，这个方法是给新增，修改，删除手动保存数据是用的
        Task<int> SaveDataAsync();
    }
}
